﻿//using Sql2000SchemaProvider;
using SchemaProvider;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Plugin.Tests
{
    
    
    /// <summary>
    ///这是 Sql2000TableCodeProviderTest 的测试类，旨在
    ///包含所有 Sql2000TableCodeProviderTest 单元测试
    ///</summary>
    [TestClass()]
    public class Sql2000TableCodeProviderTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试属性
        // 
        //编写测试时，还可使用以下属性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        //[TestMethod()]
        //public void ToPropertyNameTest()
        //{
        //    string msg = "Sql2000TableCodeProvider.ToPropertyName did not return the expected value. ";

        //    Sql2000TableCodeProvider target = new Sql2000TableCodeProvider();

        //    string columnName = null;
        //    string actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == CodeUtility.EmptyDataEntity, msg + "columnName = null");

        //    columnName = "";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == CodeUtility.EmptyDataEntity, msg + "columnName = ''");

        //    columnName = "column";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "Column", msg + "columnName =" + columnName);

        //    columnName = "column_Name";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "Column_Name", msg + "columnName =" + columnName);

        //    columnName = "Column_name";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == columnName, msg + "columnName =" + columnName);

        //    columnName = "ColumnName";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == columnName, msg + "columnName =" + columnName);

        //    TestConvertToAbbriviation(target, msg);
        //}

        //private void TestConvertToAbbriviation(Sql2000TableCodeProvider target, string msg)
        //{
        //    string columnName = "id";
        //    string actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "Id", msg + "columnName =" + columnName);

        //    columnName = "IS";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "Is", msg + "columnName =" + columnName);

        //    columnName = "by";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "By", msg + "columnName =" + columnName);

        //    columnName = "ip";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "IP", msg + "columnName =" + columnName);

        //    columnName = "Ip";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "IP", msg + "columnName =" + columnName);

        //    columnName = "iP";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == "IP", msg + "columnName =" + columnName);

        //    columnName = "IP";
        //    actual = target.ToPropertyName(columnName);
        //    Assert.IsTrue(actual == columnName, msg + "columnName =" + columnName);
        //}

        ///// <summary>
        ///// 
        ///// </summary>
        //[TestMethod()]
        //public void MapClassNameTest()
        //{
        //    string msg = "Sql2000TableCodeProvider.MapClassName did not return the expected value. ";

        //    Sql2000TableCodeProvider target = new Sql2000TableCodeProvider();

        //    string tableName = null;
        //    string actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == CodeUtility.EmptyDataEntity, msg + "tableName = null");

        //    tableName = "";
        //    actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == CodeUtility.EmptyDataEntity, msg + "tableName = ''");

        //    tableName = "table";
        //    actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == "Table", msg + "tableName =" + tableName);

        //    tableName = "tablename";
        //    actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == "Tablename", msg + "tableName =" + tableName);

        //    tableName = "tableName";
        //    actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == "TableName", msg + "tableName =" + tableName);

        //    tableName = "TableName";
        //    actual = target.MapClassName(tableName);
        //    Assert.IsTrue(actual == tableName, msg + "tableName =" + tableName);
        //}


        //[TestMethod()]
        //public void MapClassAttributeTest()
        //{
        //    Sql2000TableCodeProvider target = new Sql2000TableCodeProvider();

        //    string tableName = null;
        //    string actual = target.MapClassAttribute(tableName);

        //    tableName = "";
        //    actual = target.MapClassAttribute(tableName);

        //    tableName = "tableName";
        //    actual = target.MapClassAttribute(tableName);

        //    tableName = "TableName";
        //    actual = target.MapClassAttribute(tableName);

        //}

    }
}
